home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / midas060 / src / mutils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-16  |  5.2 KB  |  192 lines

  1. /*      MUTILS.H
  2.  *
  3.  * Miscellaneous utility functions for MIDAS Sound System used
  4.  * by various system components.
  5.  *
  6.  * $Id: mutils.h,v 1.2 1997/01/16 18:41:59 pekangas Exp $
  7.  *
  8.  * Copyright 1996,1997 Housemarque Inc.
  9.  *
  10.  * This file is part of the MIDAS Sound System, and may only be
  11.  * used, modified and distributed under the terms of the MIDAS
  12.  * Sound System license, LICENSE.TXT. By continuing to use,
  13.  * modify or distribute this file you indicate that you have
  14.  * read the license and understand and accept it fully.
  15. */
  16.  
  17. #ifndef __MUTILS_H
  18. #define __MUTILS_H
  19.  
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24.  
  25.  
  26. /****************************************************************************\
  27. *
  28. * Function:     int mGetKey(void)
  29. *
  30. * Description:  Waits for a keypress and returns the read key
  31. *
  32. * Returns:      ASCII code for the key pressed. Extended keycodes are
  33. *               returned with bit 8 set, eg. up arrow becomes \x148.
  34. *
  35. \****************************************************************************/
  36.  
  37. int CALLING mGetKey(void);
  38.  
  39.  
  40.  
  41. /****************************************************************************\
  42. *
  43. * Function:     int mStrLength(const char *str)
  44. *
  45. * Description:  Calculates the length of a ASCIIZ string
  46. *
  47. * Input:        char *str               pointer to string
  48. *
  49. * Returns:      String length excluding the terminating '\0'.
  50. *
  51. \****************************************************************************/
  52.  
  53. int CALLING mStrLength(const char *str);
  54.  
  55.  
  56.  
  57.  
  58. /****************************************************************************\
  59. *
  60. * Function:     void mStrCopy(char *dest, const char *src);
  61. *
  62. * Description:  Copies an ASCIIZ string from *src to *dest.
  63. *
  64. * Input:        char *dest              pointer to destination string
  65. *               char *src               pointer to source string
  66. *
  67. \****************************************************************************/
  68.  
  69. void CALLING mStrCopy(char *dest, const char *src);
  70.  
  71.  
  72.  
  73.  
  74. /****************************************************************************\
  75. *
  76. * Function:     void mStrAppend(char *dest, const char *src);
  77. *
  78. * Description:  Appends an ASCIIZ string to the end of another.
  79. *
  80. * Input:        char *dest              pointer to destination string
  81. *               char *src               pointer to source string
  82. *
  83. \****************************************************************************/
  84.  
  85. void CALLING mStrAppend(char *dest, const char *src);
  86.  
  87.  
  88.  
  89. /****************************************************************************\
  90. *
  91. * Function:     void mMemCopy(void *dest, const void *src, unsigned numBytes);
  92. *
  93. * Description:  Copies a memory block from *src to *dest.
  94. *
  95. * Input:        void *dest              pointer to destination
  96. *               void *src               pointer to source
  97. *               unsigned numBytes       number of bytes to copy
  98. *
  99. \****************************************************************************/
  100.  
  101. void CALLING mMemCopy(void *dest, const void *src, unsigned numBytes);
  102.  
  103.  
  104.  
  105.  
  106. /****************************************************************************\
  107. *
  108. * Function:     int mMemEqual(const void *m1, const void *m2,
  109. *                   unsigned numBytes);
  110. *
  111. * Description:  Compares two memory blocks.
  112. *
  113. * Input:        void *m1                pointer to memory block #1
  114. *               void *m2                pointer to memory block #2
  115. *               unsigned numBytes       number of bytes to compare
  116. *
  117. * Returns:      1 if the memory blocks are equal, 0 if not.
  118. *
  119. \****************************************************************************/
  120.  
  121. int CALLING mMemEqual(const void *m1, const void *m2, unsigned numBytes);
  122.  
  123.  
  124.  
  125.  
  126. /****************************************************************************\
  127. *
  128. * Function:     long mHex2Long(const char *hex)
  129. *
  130. * Description:  Converts a hexadecimal string to a long integer.
  131. *
  132. * Input:        char *hex               pointer to hex string, ASCIIZ
  133. *
  134. * Returns:      Value of the string or -1 if conversion failure.
  135. *
  136. \****************************************************************************/
  137.  
  138. long CALLING mHex2Long(const char *hex);
  139.  
  140.  
  141.  
  142.  
  143. /****************************************************************************\
  144. *
  145. * Function:     long mDec2Long(const char *dec)
  146. *
  147. * Description:  Converts an unsigned decimal string to a long integer
  148. *
  149. * Input:        char *dec               pointer to string, ASCIIZ
  150. *
  151. * Returns:      Value of the string or -1 if conversion failure.
  152. *
  153. \****************************************************************************/
  154.  
  155. long CALLING mDec2Long(const char *dec);
  156.  
  157.  
  158.  
  159.  
  160. /***************************************************************************\
  161. *
  162. * Function:     char *mGetEnv(const char *envVar);
  163. *
  164. * Description:  Searches a string from the environment
  165. *
  166. * Input:        envVar                  environment variable name, ASCIIZ
  167. *
  168. * Returns:      Pointer to environment string value (ASCIIZ), NULL if string
  169. *               was not found.
  170. *
  171. \***************************************************************************/
  172.  
  173. char * CALLING mGetEnv(const char *envVar);
  174.  
  175.  
  176. #ifdef __cplusplus
  177. }
  178. #endif
  179.  
  180.  
  181. #endif
  182.  
  183.  
  184. /*
  185.  * $Log: mutils.h,v $
  186.  * Revision 1.2  1997/01/16 18:41:59  pekangas
  187.  * Changed copyright messages to Housemarque
  188.  *
  189.  * Revision 1.1  1996/05/22 20:49:33  pekangas
  190.  * Initial revision
  191.  *
  192. */